#include "stdafx.h"

#pragma once

#ifndef __PlayerAvatar_h_
#define __PlayerAvatar_h_

#include "GameObject.h"
#include "SoundPlayer.h"
#include "fmodproj.h"
#include "Sound2d.h"
#include "AvatarPhysicsComponent.h"

class PlayerAvatar: public GameObject {
public:
	PlayerAvatar(Ogre::Vector3 position);
	~PlayerAvatar();

 	void updateLogic();
	void updateCharacter(float timestep,float dX,float dY,bool wantJump);

 	void setSceneNode(Ogre::SceneNode *node);
	void setPitchNode(Ogre::SceneNode *pitchNode);
	virtual Ogre::SceneNode* getCameraNode();
 	virtual void createMovableObject(Ogre::SceneManager* sceneMgr, unsigned int id);
	virtual void whenCameraAttached();
	virtual void whenCameraDetached();

	void turn(float amount);
	void pitchCamera(float amount);
	void fire();
	void jump();

	void setHealth(unsigned int health);
	unsigned int getHealth();
	void damage(unsigned int damage);
	bool isAlive();

	void resetFireIntensity();
	float getFireIntensity();
	bool hasJustFragged();

private:
	Ogre::SceneNode* m_pitchNode;

	unsigned int m_health;
	float m_fireIntensity;

	AvatarPhysicsComponent* m_apComp;

	//If the player just fragged someone (used in musicController)
	bool m_justFragged;
	Sound2d* m_syncSound;
	Ogre::Entity* m_entity;
};

#endif //__PlayerAvatar_h_